* @param string $copyStatus
* @param string $source
* @return string
+ * @todo Use Config obj instead of globals
*/
public static function getInitialPageText( $comment = '', $license = '',
$copyStatus = '', $source = ''
* @throws MWException
*/
protected function processVerificationError( $details ) {
- global $wgFileExtensions;
-
switch ( $details['status'] ) {
/** Statuses that only require name changing **/
} else {
$msg->params( $details['finalExt'] );
}
- $extensions = array_unique( $wgFileExtensions );
+ $extensions = array_unique( $this->getConfig()->get( 'FileExtensions' ) );
$msg->params( $this->getLanguage()->commaList( $extensions ),
count( $extensions ) );
* @return array Descriptor array
*/
protected function getSourceSection() {
- global $wgCopyUploadsFromSpecialUpload;
-
if ( $this->mSessionKey ) {
return array(
'SessionKey' => array(
$canUploadByUrl = UploadFromUrl::isEnabled()
&& ( UploadFromUrl::isAllowed( $this->getUser() ) === true )
- && $wgCopyUploadsFromSpecialUpload;
+ && $this->getConfig()->get( 'CopyUploadsFromSpecialUpload' );
$radio = $canUploadByUrl;
$selectedSourceType = strtolower( $this->getRequest()->getText( 'wpSourceType', 'File' ) );
protected function getExtensionsMessage() {
# Print a list of allowed file extensions, if so configured. We ignore
# MIME type here, it's incomprehensible to most people and too long.
- global $wgCheckFileExtensions, $wgStrictFileExtensions,
- $wgFileExtensions, $wgFileBlacklist;
+ $config = $this->getConfig();
- if ( $wgCheckFileExtensions ) {
- if ( $wgStrictFileExtensions ) {
+ if ( $config->get( 'CheckFileExtensions' ) ) {
+ if ( $config->get( 'StrictFileExtensions' ) ) {
# Everything not permitted is banned
$extensionsList =
'<div id="mw-upload-permitted">' .
$this->msg(
'upload-permitted',
- $this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions ) )
+ $this->getContext()->getLanguage()->commaList(
+ array_unique( $config->get( 'FileExtensions' ) )
+ )
)->parseAsBlock() .
"</div>\n";
} else {
'<div id="mw-upload-preferred">' .
$this->msg(
'upload-preferred',
- $this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions ) )
+ $this->getContext()->getLanguage()->commaList(
+ array_unique( $config->get( 'FileExtensions' ) )
+ )
)->parseAsBlock() .
"</div>\n" .
'<div id="mw-upload-prohibited">' .
$this->msg(
'upload-prohibited',
- $this->getContext()->getLanguage()->commaList( array_unique( $wgFileBlacklist ) )
+ $this->getContext()->getLanguage()->commaList(
+ array_unique( $config->get( 'FileBlacklist' ) )
+ )
)->parseAsBlock() .
"</div>\n";
}
* @return array Descriptor array
*/
protected function getDescriptionSection() {
+ $config = $this->getConfig();
if ( $this->mSessionKey ) {
$stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
try {
);
}
- global $wgUseCopyrightUpload;
- if ( $wgUseCopyrightUpload ) {
+ if ( $config->get( 'UseCopyrightUpload' ) ) {
$descriptor['UploadCopyStatus'] = array(
'type' => 'text',
'section' => 'description',
* Add upload JS to the OutputPage
*/
protected function addUploadJS() {
- global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview,
- $wgEnableAPI, $wgStrictFileExtensions;
+ $config = $this->getConfig();
- $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
- $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview && $wgEnableAPI;
+ $useAjaxDestCheck = $config->get( 'UseAjax' ) && $config->get( 'AjaxUploadDestCheck' );
+ $useAjaxLicensePreview = $config->get( 'UseAjax' ) &&
+ $config->get( 'AjaxLicensePreview' ) && $config->get( 'EnableAPI' );
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = array(
// the wpDestFile textbox
$this->mDestFile === '',
'wgUploadSourceIds' => $this->mSourceIds,
- 'wgStrictFileExtensions' => $wgStrictFileExtensions,
+ 'wgStrictFileExtensions' => $config->get( 'StrictFileExtensions' ),
'wgCapitalizeUploads' => MWNamespace::isCapitalized( NS_FILE ),
'wgMaxUploadSize' => $this->mMaxUploadSize,
);